// ReimbursementServiceImpl.java
package cn.edu.sdjzu.xg.eagle.bysj.service.impl;

import cn.edu.sdjzu.xg.eagle.bysj.entity.Reimbursement;
import cn.edu.sdjzu.xg.eagle.bysj.Mapper.ReimbursementMapper;
import cn.edu.sdjzu.xg.eagle.bysj.service.Interface.ReimbursementServiceInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReimbursementServiceImpl implements ReimbursementServiceInterface {

    @Autowired
    private ReimbursementMapper reimbursementMapper;

    @Override
    public List<Reimbursement> getAllReimbursements() {
        return reimbursementMapper.selectAllReimbursements();
    }

    @Override
    public Reimbursement getReimbursementById(String reimbursement_ID) {
        return reimbursementMapper.selectReimbursementById(reimbursement_ID);
    }

    @Override
    public String saveReimbursement(Reimbursement reimbursement) {
        if (reimbursementMapper.insertReimbursement(reimbursement) == 1) {
            return "报销记录保存成功";
        }
        return "报销记录保存失败";
    }

    @Override
    public String updateReimbursement(Reimbursement reimbursement) {
        if (reimbursementMapper.updateReimbursement(reimbursement) == 1) {
            return "报销记录更新成功";
        }
        return "报销记录更新失败";
    }

    @Override
    public String deleteReimbursement(String reimbursement_ID) {
        if (reimbursementMapper.deleteReimbursement(reimbursement_ID) == 1) {
            return "报销记录删除成功";
        }
        return "报销记录删除失败";
    }
}